home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Extras / IFF / IFF_Forms / 8SVX.CHAN.PAN.doc < prev    next >
Encoding:
Text File  |  1993-03-01  |  4.1 KB  |  97 lines

  1. Stereo chunks for 8SVX form
  2.  
  3.                      SMUS.CHAN and SMUS.PAN Chunks
  4.             Stereo imaging in the "8SVX" IFF 8-bit Sample Voice 
  5.             ---------------------------------------------------
  6.                  Registered by David Jones, Gold Disk Inc.
  7.  
  8. There are two ways to create stereo imaging when playing back a digitized
  9. sound. The first relies on the original sound being created with a stereo
  10. sampler: two different samples are digitized simultaneously, using right and
  11. left inputs. To play back this type of sample while maintaining the
  12. stereo imaging, both channels must be set to the same volume. The second type
  13. of stereo sound plays the identical information on two different channels at
  14. different volumes. This gives the sample an absolute position in the stereo
  15. field. Unfortunately, there are currently a number of methods for doing this
  16. currently implemented on the Amiga, none truly adhering to any type of
  17. standard. What I have tried to to is provide a way of doing this
  18. consistently, while retaining compatibility with existing (non-standard)
  19. systems. Introduced below are two optional data chunks, CHAN and PAN. CHAN
  20. deals with sounds sampled in stereo, and PAN with samples given stereo
  21. characteristics after the fact.
  22.  
  23.  
  24. Optional Data Chunk CHAN
  25. ________________________
  26.  
  27. This chunk is already written by the software for a popular stereo sampler. To
  28. maintain the ability read these samples, its implementation here is 
  29. therefore limited to maintain compatability.
  30.  
  31. The optional data chunk CHAN gives the information neccessary to play a
  32. sample on a specified channel, or combination of channels. This chunk
  33. would be useful for programs employing stereo recording or playback of sampled
  34. sounds. 
  35.     
  36.     #define RIGHT        4L
  37.     #define LEFT        2L
  38.     #define STEREO        6L
  39.     
  40.     #define ID_CHAN MakeID('C','H','A','N')
  41.     
  42.     typedef sampletype LONG;
  43.     
  44. If "sampletype" is RIGHT, the program reading the sample knows that it was
  45. originally intended to play on a channel routed to the right speaker,
  46. (channels 1 and 2 on the Amiga). If "sampletype" is LEFT, the left speaker
  47. was intended (Amiga channels 0 and 3). It is left to the discretion of the
  48. programmer to decide whether or not to play a sample when a channel on the
  49. side designated by "sampletype" cannot be allocated. 
  50.  
  51. If "sampletype" is STEREO, then the sample requires a pair of channels routed
  52. to both speakers (Amiga pairs [0,1] and [2,3]). The BODY chunk for stereo
  53. pairs contains both left and right information. To adhere to existing
  54. conventions, sampling software should write first the LEFT information,
  55. followed by the RIGHT. The LEFT and RIGHT information should be equal in
  56. length.
  57.  
  58. Again, it is left to the programmer to decide what to do if a channel for
  59. a stereo pair can't be allocated; wether to play the available channel only,
  60. or to allocate another channels routed to the wrong speaker. 
  61.  
  62.  
  63.  
  64. Optional Data Chunk PAN
  65. _______________________
  66.  
  67. The optional data chunk PAN provides the neccessary information to create a
  68. stereo sound using a single array of data. It is neccessary to replay the 
  69. sample simultaneously on two channels, at different volumes. 
  70.  
  71.     #define ID_PAN MakeID('P','A','N',' ')
  72.     
  73.     typedef sposition Fixed; /* 0 <= sposition <= Unity */
  74.                              /* Unity is elsewhere #defined as 10000L, and
  75.                               * refers to the maximum possible volume.
  76.                               * /
  77.     
  78.     /* Please note that 'Fixed' (elsewhere #defined as LONG) is used to 
  79.      * allow for compatabilty between audio hardware of different resolutions.
  80.      */
  81.      
  82. The 'sposition' variable describes a position in the stereo field. The
  83. numbers of discrete stereo positions available is equal to 1/2 the number of
  84. discrete volumes for a single channel.
  85.  
  86. The sample must be played on both the right and left channels. The overall
  87. volume of the sample is determined by the "volume" field in the Voice8Header
  88. structure in the VHDR chunk. 
  89.  
  90. The left channel volume = overall volume / (Unity / sposition). 
  91.  "  right   "       "   = overall volume - left channel volume.
  92.  
  93. For example:
  94.     If sposition = Unity, the sample is panned all the way to the left.
  95.     If sposition = 0, the sample is panned all the way to the right.
  96.     If sposition = Unity/2, the sample is centered in the stereo field.
  97.